function gcd(a, b) {
    if (b === 0) return a;
    return gcd(b, a % b);
}

function lcm(a, b) {
    return a * b / gcd(a, b);
}

function smallestCommons(arr) {
    let ret = 1;
    //arr.map(function(val){ret=lcm(ret,val);});
    arr.sort(function (a, b) {
        return a - b;
    });
    for (let i = arr[0]; i <= arr[1]; i++)
        ret = lcm(ret, i);
    return ret;
}


console.log(smallestCommons([1, 5]));
